﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using haptic.src.engine;
using haptic.src.engine.render;
using haptic.src.engine.core;

namespace haptic.src.components
{
    [Serializable]
    public class cCamera : Component
    {
        #region Constructors
        public cCamera(){}
        public cCamera(Entity oOwner) : base(oOwner) {}
        #endregion

        #region Load
        public override Result Load(Scene oScene, Microsoft.Xna.Framework.Content.ContentManager oContent)
        {
            m_oScene = oScene;
            if (base.Load(oScene, oContent).IsFailed())
                return new Failed();
            oScene.m_oCameraManager.Add("default", m_oCamera);
            oScene.m_oCameraManager.SetCurrent("default");
            m_oCamera.m_vInitialPosition = m_oEntity.m_vPosition;
            return Result.Success;
        }
        #endregion

        #region Update
        public override void Update(Microsoft.Xna.Framework.GameTime oTime)
        {
            m_oCamera.m_vPosition = m_oEntity.m_vPosition;
            base.Update(oTime);
        }
        #endregion

        #region Attributes
        protected Camera m_oCamera = new Camera();
        protected Scene m_oScene;
        #endregion
    }
}
